<?php
	require_once( "functions/inc_systemFunctions.php" );
	if( getShoppingListItemSeenInStore( $_GET['pid'], getShoppingListId( $_SESSION['user_id'] ) ) === true ){
		$setTo = 0;
	} else {
		$setTo = 1;
	}
	$sql = "UPDATE shoppingListItems SET seenInStore=" . $setTo . " WHERE shoppingList_id = " . getShoppingListId( $_SESSION['user_id'] ) . " AND product_id = " . $_GET['pid'];
	$res = mysql_query( $sql );
	if( $res ){
		header( "Location: " . $_SERVER['HTTP_REFERER'] );
	} else {
		echo "<p class=\"red\">Status could not be changed.</p>";
	}
?>